import { MAP } from "../../Types";
import { TILE } from "../../enum";
export function GetSurroundingWallCount(
    gridX: number,
    gridY: number,
    map: MAP
) {
    let wallCount = 0;
    map.$mapAround(
        gridX,
        gridY,
        // 统计周围8个点的情况，请参考 Moore neighborhood(https://en.wikipedia.org/wiki/Moore_neighborhood)
        (value, x, y) => {
            if (!(x === gridX && y === gridY) && value === TILE.Wall) {
                wallCount++;
            }
        },
        () => wallCount++
    );
    return wallCount;
}
